﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CodeMark.Library;
using WeifenLuo.WinFormsUI.Docking;

namespace CodeMark
{
    public partial class frmMain : Form
    {
        private frmLeft frmLeftBar = new frmLeft();
        public static frmMain frmTemp = null;
        private string m_strConfigFile;
        private DeserializeDockContent m_deserializeDockContent;

        //1. 添加源代码
        //2. 添加文章( 可引用相关代码)
        //3. 添加网址收藏
        //3.5 可自动下载Cnblogs,CSDNBlog...文章
        //4. 添加关键字
		//5. 事务提醒功能
		//6. 视力保护程序(可选）
        public frmMain()
        {
            InitializeComponent();

            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            frmTemp = this;
            m_strConfigFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            if (File.Exists(m_strConfigFile))
            {
                dockPanel1.LoadFromXml(m_strConfigFile, m_deserializeDockContent);
            }
            frmLeftBar.Show(this.dockPanel1, DockState.DockLeft);
        }

        private IDockContent GetContentFromPersistString(string persistString)
        {
            if (persistString == typeof(frmLeft).ToString())
            {
                return frmLeftBar;
            }
            else
            {
                // 可以加的其它子窗体
                return null;
            }
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            CodeMark.Library.ShowMsg showMsg=new ShowMsg("测试标题","哈哈哈",3000);
            showMsg.Show();
        }
    }
}
